#!/usr/bin/env node
const Dog = require('./02-dog');
const d1 = new Dog('taidi',5),
      d2 = new Dog('zangao',9);
function onBark(){
    console.log(this.name, this.energy);
}
d1.on('bark',onBark.bind(d1));
d2.on('bark',onBark.bind(d2));
setTimeout(()=>{
    d1.energy = 5;
},6000);